package com.example.currentlimiting.web;


import com.example.currentlimiting.annotation.FlowLimit;
import com.example.currentlimiting.annotation.FlowType;
import com.example.currentlimiting.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;




@RestController
public class TestController
{
    @Autowired
    TestService testService;


    /**
     * 50秒内，同一ip最大请求3次
     */
    @FlowLimit(time=50,count=3,limitType= FlowType.IP)
    @GetMapping("/test")
    public String test()
    {
       return testService.test();
    }
}
